﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using SC_BLL;

namespace Showcase.Ajax
{
    /// <summary>
    /// ShowcaseHandler 的摘要说明
    /// </summary>
    public class ShowcaseHandler : IHttpHandler
    {
        SC_BLL.Showcase bllShowcase = new SC_BLL.Showcase();

        public void ProcessRequest(HttpContext context)
        {
            string reValue = string.Empty;

            string act = context.Request.QueryString["act"];

            switch (act)
            { 
                case "GetItemsOnsale":
                    string title = context.Request.QueryString["title"];
                    int pageno = Convert.ToInt32(context.Request.QueryString["pageno"]);

                    reValue = bllShowcase.GetItemsOnsale(title, pageno);
                    break;
                case "Logout":
                    Client.Logout();
                    break;
            }

            context.Response.ContentType = "application/json";
            context.Response.Write(reValue);
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}